"""
Should check for platform backend only if certain repository
type is defined in django.conf.settings.
"""

import time
import datetime

from vcbrowser.enumerations import RepositoryType, NodeKind

class VCBrowserError(Exception): pass

class EngineError(VCBrowserError): pass

class BaseEngine(object):
    """
    Base class for all engines.
    We use other nomenclature than at nodes module.
    Engine operates on 'entries', specific for backend,
    and returns nodes.
    """

    HEAD_REVISION = -1

    def __init__(self, repo_url):
        self.repo_url = repo_url
        self.url = None
        self.revision = None
        self.requested_node = None
        self.entry_list = []

    def __str__(self):
        return '<%s at %s>' % (self.__class__.__name__, self.repo_url)
    
    def request(self, url, revision=HEAD_REVISION, fetch_content=True):
        raise NotImplementedError()
    
    def fetch_nodes(self, url, revision=HEAD_REVISION):
        raise NotImplementedError()

    def get_file_content(self, url, revision=HEAD_REVISION):
        raise NotImplementedError()

    def walk(self, topurl, revision=HEAD_REVISION, fetch_files_content=False):
        raise NotImplementedError()
    


